<template>
    <div class="module-cont">
        <div v-for="item in data" class="moduleItem" @click="checkDetail(item)">
            <div class="module-cont-box">
                <div class="content">
                    <div class="content-icon">
                        <img src="@/assets/images/registerManage/relation_icon.png" alt="" srcset="">
                    </div>
                    <div class="content-info">
                        <div class="title">{{ item.asset_package_name }}</div>
                        <div class="info">{{ item.asset_package_desc }}</div>
                    </div>
                </div>
                <div class="btn" v-auth:checkPermission="checkPermission">
                    <icon-right />
                </div>
            </div>
            
        </div>
    </div>
</template>

<script setup lang="ts">
import type { PackageDataItem } from "@/api/resource_registration/resource_registration_type";
import { useRoute, useRouter } from "vue-router"
const route = useRoute()
const router = useRouter()
defineProps({
    data: Array<PackageDataItem>,
    checkPermission: Array,
})
const checkDetail = (row:any) => {
    localStorage.setItem('query', row.asset_package_code)
    router.push(`/ResourcePackage/details?id=${row.asset_package_id}`)
}
</script>

<style lang="less" scoped>
.module-cont {
    display: flex;
    flex-wrap: wrap;
    margin-top: 24px;
    &-box {
        display: flex;
        justify-content: space-between;
        align-items:center;
        .btn {
            width: 16px;
        }
    }

    .moduleItem {
        width: calc((100% - 40px) / 3);
        background: #fff;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 20px;
        margin-right: 20px;
        border: 1px solid #EBF0FA;
        cursor: pointer;
        &:hover {
            background: #F7F9FC;
        }
        &:nth-child(3n) {
            margin-right: 0;
        }
        .content {
            flex: 1;
            display: flex;
            &-icon {
                width: 48px;
            }
            &-info {
                flex: 1;
                padding-left: 10px;
            }
        }

        img {
            width: 48px;
            height: 48px;
            background: #D9E7FA;
            border-radius: 100%;
        }

        .title {
            font-size: 16px;
            font-weight: bold;
            color: #465A80;
            line-height: 24px;
        }

        .info {
            flex: 1;
            font-size: 14px;
            color: #A3B0CC;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
}
:deep(.arco-icon) {
    color: #A3B0CC;
}
</style>